------------------------------------------------------------------------
--  Create Addon
------------------------------------------------------------------------
local LibStub = _G.LibStub
local BarPlug = LibStub("AceAddon-3.0"):NewAddon("BarPlug")
local LDB = LibStub("LibDataBroker-1.1")

------------------------------------------------------------------------
--  Setup Addon
------------------------------------------------------------------------
function BarPlug:OnInitialize()
	for name, dataobj in LDB:DataObjectIterator() do
		self:NewPlugin(nil, name, dataobj)
	end
	LDB.RegisterCallback(self, "LibDataBroker_DataObjectCreated", "NewPlugin")
end

function BarPlug:OnEnable()
	-- nothing yet
end

function BarPlug:OnDisable()
	for name in self:IteratePlugins() do
		self:DisablePlugin(name)
	end
	LDB.UnregisterAllCallbacks(self)
end
